(watch all)

(do-backward-chaining foo)

(do-backward-chaining bar)


(defrule rule-1
  (foo ?A ?B)
  =>
  (printout t foo crlf)
)

(defrule create-foo
  (need-foo $?)
  (bar ?X ?Y)
  =>
  (assert (foo A B))
)

(defrule create-bar
  (need-bar $?)
  =>
  (assert (bar C D))
)


(reset)

(run)